package com.lizhen.createpattern.factorypattern;

import com.lizhen.createpattern.factorypattern.impl.Circle;
import com.lizhen.createpattern.factorypattern.impl.Rectangle;
import com.lizhen.createpattern.factorypattern.impl.Square;

public class ShapeFactory {
    public ShapeFactory() {
    }

    public Shape getShape(String shapeType) {
        if (shapeType == null) {
            return null;
        } else if (shapeType.equalsIgnoreCase("CIRCLE")) {
            return new Circle();
        } else if (shapeType.equalsIgnoreCase("RECTANGLE")) {
            return new Rectangle();
        } else {
            return shapeType.equalsIgnoreCase("SQUARE") ? new Square() : null;
        }
    }
}
